package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Mapper
public interface ReportMapper {

    @Select("select sum(orders.amount) from orders where status = 5 and order_time between #{begin} and #{end} ")
    Double getTurnoverStatistics(String begin, String end);

    @Select("select count(id) from user where create_time between #{begin} and #{end} ")

    Integer getUserStatisticsWithDate(LocalDate begin, LocalDate end);

    Integer getOrderCountByStatus(LocalDate begin, LocalDate end, Integer status);

    @MapKey("name")
    List<GoodsSalesDTO> getTop10(LocalDate begin, LocalDate end);
}
